<template>
  <div class="message">
    <el-popover placement="bottom" :width="310" trigger="click">
      <template #reference>
        <div class="handle-message">
          <el-badge is-dot class="item">
            <el-icon><ChatLineRound /></el-icon>
          </el-badge>
        </div>
      </template>
      <el-tabs v-model="activeName">
        <el-tab-pane label="通知(5)" name="first">
          <div class="message-list">
            <div class="message-item">
              <img
                src="https://ts4.cn.mm.bing.net/th?id=ODLS.d87cb855-ded8-4732-827b-ad001f2fa9b3&w=16&h=16&o=6&pid=1.2"
                alt=""
                class="message-icon"
              />
              <div class="message-content">
                <span class="message-title">TSJ 🧡</span>
                <span class="message-date">一分钟前</span>
              </div>
            </div>
            <div class="message-item">
              <img
                src="https://ts4.cn.mm.bing.net/th?id=ODLS.d87cb855-ded8-4732-827b-ad001f2fa9b3&w=16&h=16&o=6&pid=1.2"
                alt=""
                class="message-icon"
              />
              <div class="message-content">
                <span class="message-title">TSJ 💙</span>
                <span class="message-date">一小时前</span>
              </div>
            </div>
            <div class="message-item">
              <img
                src="https://ts4.cn.mm.bing.net/th?id=ODLS.d87cb855-ded8-4732-827b-ad001f2fa9b3&w=16&h=16&o=6&pid=1.2"
                alt=""
                class="message-icon"
              />
              <div class="message-content">
                <span class="message-title">TSJ 💚</span>
                <span class="message-date">半天前</span>
              </div>
            </div>
            <div class="message-item">
              <img
                src="https://ts4.cn.mm.bing.net/th?id=ODLS.d87cb855-ded8-4732-827b-ad001f2fa9b3&w=16&h=16&o=6&pid=1.2"
                alt=""
                class="message-icon"
              />
              <div class="message-content">
                <span class="message-title">TSJ 💜</span>
                <span class="message-date">一星期前</span>
              </div>
            </div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="消息(0)" name="second">
          <div class="message-empty">
            <img src="@/assets/images/notData.png" alt="notData" />
            <div>暂无消息</div>
          </div>
        </el-tab-pane>
        <el-tab-pane label="代办(0)" name="third">
          <div class="message-empty">
            <img src="@/assets/images/notData.png" alt="notData" />
            <div>暂无代办</div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-popover>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'

const activeName = ref('first')
</script>

<style scoped lang="scss">
.message {
  cursor: pointer;
}
.handle-message {
  width: 40px;
  line-height: 40px;
  border-radius: 3px;
  background-color: #fff;
  text-align: center;
  .item {
    :deep(.el-badge__content) {
      top: 8px;
      width: 6px;
      height: 6px;
    }
  }
}
.message-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 260px;
  line-height: 45px;
}
.message-list {
  display: flex;
  flex-direction: column;
  .message-item {
    display: flex;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--el-border-color-light);
    &:last-child {
      border: none;
    }
    .message-icon {
      width: 40px;
      height: 40px;
      margin: 0 20px 0 5px;
    }
    .message-content {
      display: flex;
      flex-direction: column;
      .message-title {
        margin-bottom: 5px;
      }
      .message-date {
        font-size: 12px;
        color: var(--el-text-color-secondary);
      }
    }
  }
}
</style>
